<include file="Common:layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>广告位设置</h3>
                <h5>商城首页广告位设置</h5>
            </div>
        </div>
    </div>
    <!-- 操作说明 -->
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span id="explanationZoom" title="收起提示"></span> </div>
        <ul>
            <li>标注的位置与首页设置的位置一致，上传图片请注意尺寸比率对应。</li>
        </ul>
    </div>
    <form method="post" id="handlepost" action="{:U('Index/ad_edit')}" enctype="multipart/form-data" name="form1">
        <input type="hidden" name="ad_id" value="{$ad.ad_id}"/>
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>选择位置</label>
                </dt>
                <dd class="opt">
                    <select name="ad_code" id="ad_code">
                        <option value="banner" <if condition="$ad['ad_code'] eq 'banner'">selected</if>>滚动图</option>
                        <option value="brand" <if condition="$ad['ad_code'] eq 'brand'">selected</if>>品牌栏</option>
                        <option value="lattice" <if condition="$ad['ad_code'] eq 'lattice'">selected</if>>九宫格</option>
                        <option value="list" <if condition="$ad['ad_code'] eq 'list'">selected</if>>大图列表</option>
                    </select>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="store_logo">广告大图</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show">
                        <span class="show">
                            <a id="img_a" class="nyroModal" rel="gal" href="{$ad.ad_pic}">
                                <i id="img_i" class="fa fa-picture-o" onmouseover="layer.tips('<img src={$ad.ad_pic}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                            </a>
                        </span>
           	            <span class="type-file-box">
                            <input type="text" id="store_logo" name="ad_pic" class="type-file-text" value="{$ad.ad_pic}">
                            <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','ad','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic">请按照规格比率上传图片</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="store_title">广告名称</label>
                </dt>
                <dd class="opt">
                    <input id="store_title" name="ad_name" class="input-txt" type="text" required value="{$ad.ad_name}"/>
                    <p class="notic">广告位名称</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="store_desc">跳转链接</label>
                </dt>
                <dd class="opt">
                    <input id="store_desc" name="ad_link" class="w500" type="text" required value="{$ad.ad_link}"/>
                    <p class="notic">跳转到此地址</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>权重</label>
                </dt>
                <dd class="opt">
                    <input name="ad_weight" value="{$ad.ad_weight}" id="ad_weight" class="input-txt" type="text" required data-type="number"/>
                    <span class="err"></span>
                    <p class="notic">设置广告位的位置，权重越低越靠前</p>
                </dd>
            </dl>
            <div class="bot">
                <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" id="submit">确认提交</a>
            </div>
        </div>
    </form>
</div>
<div id="goTop"> <a href="JavaScript:void(0);" id="btntop"><i class="fa fa-angle-up"></i></a><a href="JavaScript:void(0);" id="btnbottom"><i class="fa fa-angle-down"></i></a></div>
</body>
<script type="text/javascript">
    function img_call_back(fileurl_tmp)
    {
        $("#store_logo").val(fileurl_tmp);
        $("#img_a").attr('href', fileurl_tmp);
        $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
    }

    $(function(){
        $("#submit").click(function(){
            var store_logo = $("#store_logo").val();
            var ad_name = $("#store_title").val();
            var ad_link = $("#store_desc").val();
            var ad_weight = $("#ad_weight").val();
            if(!store_logo){
                layer.msg("图片必需上传！" ,{icon: 8, time:1500});return false;
            }
            if(!ad_name){
                layer.msg("名称必填！" ,{icon: 8, time:1500});return false;
            }
            if(!ad_link){
                layer.msg("地址必填！" ,{icon: 8, time:1500});return false;
            }
            if(!ad_weight){
                layer.msg("权重必填！" ,{icon: 8, time:1500});return false;
            }
            $("#handlepost").submit();
        });
    });
</script>
</html>